﻿/*
 *by zhihuinengyuan
 */

#include <vector>
#include <string>
#include "DatWriteBack.h"
#include <BPAFilesIO.h>

namespace BPA{
    namespace impl{
        class N_KAnalysis
        {
        public:
            N_KAnalysis();
            ~N_KAnalysis();

            const char *database;

            int caseid;

            // zones' number can be 1,2,..., default: all zones
            std::vector <std::string> Zone;

            // voltage must be a vector of size 2
            // and voltage[0] >= voltage[1]
            std::vector <double> Voltage;

            void InitConfig();

            bool N_1Analysis();

            void N_1PfoDataToPre();

            std::vector <Line> AnnotateLines;

            bool N_2Analysis();

            bool N_3Analysis();

            //断开双回线，多dat文件
            bool GetN_2Dats();

            //断开三回线，多dat文件
            bool GetN_3Dats();

            void Pfo2database(
                int n_k_flag,
                std::string pfo_filename,
                BPAFilesIO::BusResultVector bus_overvoltage_list,
                BPAFilesIO::LineResultVector line_overload_list);
            void Pfo2database(
                int n_k_flag,
                std::string pfo_filename,
                BPAFilesIO::N_1pfo_BaseOverVector baseover_list,
                BPAFilesIO::N_1pfo_BreakPro_BusVector bus_overvoltage_list,
                BPAFilesIO::N_1pfo_BreakProVetor line_overload_list,
                BPAFilesIO::N_1pfo_NoneVector divergence_list);

            std::string getN23OutString();

        private:
            bool CallPfnt(std::string DatFilePath);

            //字符串修改，将'（西文）号改为’（中文）号
            std::string CharToChange(std::string str);

        };
    }
}
